# Contributor: Iztok Fister, Jr. <iztok@iztok-jr-fister.eu>
# Maintainer: Iztok Fister, Jr. <iztok@iztok-jr-fister.eu>
pkgname=py3-metric-learn
pkgver=0.7.0
pkgrel=0
pkgdesc="Metric learning algorithms in Python"
url="https://github.com/scikit-learn-contrib/metric-learn"
# py3-scikit-learn is missing on s390x
arch="noarch !s390x"
license="MIT"
depends="
	python3
	py3-numpy
	py3-scipy
	py3-scikit-learn
	"
makedepends="py3-gpep517 py3-setuptools py3-wheel"
checkdepends="py3-pytest-xdist"
subpackages="$pkgname-pyc"
source="https://github.com/scikit-learn-contrib/metric-learn/archive/v$pkgver/metric-learn-$pkgver.tar.gz"
builddir="$srcdir/metric-learn-$pkgver"
# the most recent version of sklearn removed the sklearn.utils.testing that is used in tests
# hence, we disable tests for now
options="!check"

build() {
	gpep517 build-wheel \
		--wheel-dir .dist \
		--output-fd 3 3>&1 >&2
}

check() {
	python3 -m venv --clear --without-pip --system-site-packages .testenv
	.testenv/bin/python3 -m installer .dist/*.whl
	.testenv/bin/python3 -m pytest -n auto
}

package() {
	python3 -m installer -d "$pkgdir" \
		.dist/*.whl
}

sha512sums="
b5e3135e996a9b787a789d4d0d19543b1b245a1ff42534438984010736eec6b193187169b9a0054a459d95eef17b71287aed8ea7565207ad5f6334b83a543bb2  metric-learn-0.7.0.tar.gz
"
